package creationPattern.Factory.Factory_02.factory;

import creationPattern.Factory.Factory_02.service.IFreeGoods;
import creationPattern.Factory.Factory_02.service.impl.DiscountService;
import creationPattern.Factory.Factory_02.service.impl.SmallGiftService;
import creationPattern.Factory.Factory_02.service.impl.YouKuMemberService;

/**
 * 具体工厂：创建对应的对象
 */
public class FreeGoodsFactory {
    public static IFreeGoods getServiceInstance(Integer awardType){
        IFreeGoods instance = null;
        switch (awardType){
            case 1:
                instance = new DiscountService();
                break;
            case 2:
                instance = new YouKuMemberService();
                break;
            case 3:
                instance = new SmallGiftService();
        }
        return instance;
    }
}
